package random;

import java.util.Date;
import java.util.Random;

import pojo.Book;

public class RandomBuilderImpl implements RandomBuilder{
	public static String[] bnameS= {"aaa","bbb","ccc","ddd","eee"};
	public static String[] authorS={"mike","tom","john","ziv","amy"};
	public static String[] publisherS={"Springer","Elsevier","Artech House","Xinhua","Prentice Hall"};
	private int rand;
	private boolean randb;
	private double randd;
	public Book randomBuild() {
		Book b = new Book();
		
		b.setId(null);
		
		rand = new Random().nextInt(5);
		b.setBname(RandomBuilderImpl.bnameS[rand]);
		
		b.setPubDate(new Date());
		
		rand = new Random().nextInt(5);
		b.setAuthor(RandomBuilderImpl.authorS[rand]);
		
		rand = new Random().nextInt(5);
		b.setPublisher(RandomBuilderImpl.publisherS[rand]);
		
		randb = new Random().nextBoolean();
		b.setNew(randb);
		
		randd = new Random().nextDouble()*100.0;
		b.setPrice(randd);
		
		return b;
	}

}
